package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static java.lang.System.out;

/**
 * Created by malliks on 24/02/14.
 */
public class Library {

       Registry registry=new Registry();

    public void displayBook()
    {
        System.out.println("Books are");

        for (Object list : registry.getBooklist())
        {
            out.println(list.toString());
        }

    }
    public void displayMoive()
    {
        if(registry.getMovielist().isEmpty())
            System.out.print("There are no Movies to display\n");
        else
        {
        System.out.println("Movies Are");
            System.out.println("Name        Year      Director      Rating");

        for(Movie list:registry.getMovielist())
        {

            System.out.println(list.getName()+"     "+list.getYear()+"      "+list.getDirector()+"      "+list.getRating());
        }
        }
    }

    public void checkOutMovies(String moviename)
    {
        if(registry.checkOutMovie(moviename))
            System.out.println("Thank you! Enjoy the Movie");
        else
            System.out.println("That Movie is not available .... please make sure that Movie exist");
    }

    public void checkOutBooks(String bookname)
    {

        if(registry.checkOutBook(bookname))
            System.out.println("Thank you! Enjoy the book");
        else
            System.out.println("That book is not available .... please make sure that book exist");
    }

    public void BookReturn(String bookname)
    {
        if(registry.returnBook(bookname))
            System.out.println("Thank you for returning the book");
        else
            System.out.println("That is not a valid book to return ... please make sure that you returning correct book");
    }

    public boolean userAthentication(String library_number, String password)
    {
        if(registry.authentication(library_number,password))
          return true;
        else
        {
        System.out.print("Authentication failed ... library number or password is wrong\n");
            return false;
        }
    }
}



